package tw.cating.karmasaver.plurk;

import tw.cating.Utility.DBUtil;
import android.content.Context;

public class Log {
	
	static public void i(String tag, String content) {
		Log inst = getInstance();
		if (inst != null) {
			inst.getDB().writeLog(tag, 0, content);
		}
	}
	
	static public void w(String tag, String content) {
		Log inst = getInstance();
		if (inst != null) {
			inst.getDB().writeLog(tag, 1, content);
		}
	}
	
	static public void e(String tag, String content) {
		Log inst = getInstance();
		if (inst != null) {
			inst.getDB().writeLog(tag, 2, content);
		}
	}
	
	protected static Log mInstance = null;
	private DBUtil db = null;
	
	protected Log(Context context) {
		db = new DBUtil(context);
	}

	public DBUtil getDB() {
		return db;
	}
	
	public static Log getInstance(Context context) {
		if (mInstance == null)
			mInstance = new Log(context);
		
		return mInstance;
	}
	
	public static Log getInstance() {
		return mInstance;
	}
}
